package com.doumuxie.util;


import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author doumuxie https://gitee.com/doumuxie/
 * @version 1.0
 * @date 2020/10/14 20:17
 * @description Response 封装
 **/
public class ResponseUtil {


    public static HttpServletResponse sendResponse(HttpServletResponse httpServletResponse, ResultUtil result) throws IOException {
        httpServletResponse.setCharacterEncoding("utf-8");
        httpServletResponse.setContentType("application/json;charset=utf-8");
        httpServletResponse.getWriter().write(JSON.toJSONString(result));
        return httpServletResponse;
    }
}
